#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2020/7/15 13:51
# @Author  : CoderCharm
# @File    : views.py
# @Software: PyCharm
# @Github  : github/CoderCharm
# @Email   : wg_python@163.com
# @Desc    :
"""

用户视图

"""

from fastapi import APIRouter, Depends,Query
from sqlalchemy.orm import Session
from api.utils import response_code

from api.common import deps
import re
router = APIRouter()




@router.get("/test", summary="测试")
async def test(mobile:str='',code:int=0):
    # 获取参数
    # 校验参数
    if not all([mobile,code]):
        return response_code.resp_1001(message='必须都得输入')
    # 正则匹配手机号

    res=re.match("^1[3-9][0-9]{9}$",mobile)
    if not res:
        return response_code.resp_1002(message='手机号格式错误')
    return 'ok'